﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 **/

using System;
using System.Collections.Generic;
using System.Windows.Input;
using Peter.Common.Code;
using Peter.Common.Dialog;

namespace Peter.Common.Interfaces
{
    /// <summary>
    /// Interface for peter interactions.
    /// </summary>
    public interface IPeter
    {
        /// <summary>
        /// Event that occurs when the application is shutting down.
        /// </summary>
       event EventHandler ShuttingDown;

       /// <summary>
       /// Event that occurs when the active content in Peter has changed.
       /// </summary>
       event EventHandler ActiveContentChanged;

        /// <summary>
        /// Gets the version of Peter being used.
        /// </summary>
        Version Version { get; }

       /// <summary>
       /// Gets the active content.
       /// </summary>
       object ActiveContent { get; set; }

       /// <summary>
       /// Gets the active document object, null if object is not a document.
       /// </summary>
       IPeterDocument ActiveDocument { get; }

       /// <summary>
       /// Gets the list of available code completion items.
       /// </summary>
       IEnumerable <BaseCodeCompletion> CodeCompletions { get; set; }

       /// <summary>
        /// Gets an enumeration of all the currently open content in Peter.
        /// </summary>
        /// <returns>All open content in Peter.</returns>
       IEnumerable<IDockItem> GetAllOpenContent ();

        /// <summary>
        /// Adds a new item to the current document group 
        /// </summary>
        /// <param name="documentModel">The model of the item to add.</param>
        void AddDocument(IPeterDocument documentModel);

        /// <summary>
        /// Adds a tool window.
        /// </summary>
        /// <param name="toolWindowModel">The model of the item to add.</param>
        void AddToolWindow(IPeterToolWindow toolWindowModel);

        /// <summary>
        /// Creates a new file.
        /// </summary>
        IPeterEditor NewFile ();

        /// <summary>
        /// Opens the given file.
        /// </summary>
        /// <param name="filePath">The full path to the file to open.</param>
        IPeterFileDocument Open (string filePath);

        /// <summary>
        /// Opens the given project item.
        /// </summary>
        /// <param name="projectItem">The project item to open.</param>
        void Open (PeterProjectItem projectItem);

        /// <summary>
        /// Opens the given files.
        /// </summary>
        /// <param name="filePaths">A list of full file paths to open.</param>
        void Open(IEnumerable<string> filePaths);

        /// <summary>
        /// Updates the title of the application.
        /// </summary>
        void UpdateTitle();

        /// <summary>
        /// Registers the given key binding with the application for hot key support.
        /// </summary>
        /// <param name="binding">The key binding to register.</param>
       void RegisterHotkey (KeyBinding binding);

       /// <summary>
       /// Shows the options tab.
       /// </summary>
       /// <param name="startingOptionPage">The options page to start up.</param>
       void ShowOptions (object startingOptionPage = null);

       /// <summary>
       /// Closes the document with the given model.
       /// </summary>
       /// <param name="documentModel">Model to close.</param>
       void CloseDocument (IPeterDocument documentModel);

       /// <summary>
       /// Closes the tool window with the given model.
       /// </summary>
       /// <param name="tooWindowModel">Model to close.</param>
       void CloseToolWindow (IPeterToolWindow tooWindowModel);

       /// <summary>
       /// Shows the requested window.
       /// </summary>
       /// <param name="window">Window to show.</param>
       void ShowToolWindow (PeterToolWindows window);

       /// <summary>
       /// Shows the given dialog.
       /// </summary>
       /// <param name="dialogContent">Dialog content to show.</param>
       DialogCloseAction ShowDialog (DialogBase dialogContent);

      /// <summary>
      /// Updates peter documents when a file has been moved.
      /// </summary>
      /// <param name="oldPath">The full path to the old file.</param>
      /// <param name="newPath">The full path to the new file.</param>
      void FileMoved (string oldPath, string newPath);
    }
}
